<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>编辑《 ${detail.name}》</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <script src="../js/jquery-3.2.1.js"></script>
    <script src="../js/bootstrap.min.js" ></script>
    <script>
        $(function () {
            $('#header').load('/admin_header.html');
        })
    </script>
</head>
<body background="../img/book2.jpg" style=" background-repeat:no-repeat ;
background-size:100% 100%;
background-attachment: fixed;">

<div id="header" style="padding-bottom: 80px"></div>

<div class="col-xs-6 col-md-offset-3" style="position: relative;">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">编辑《 ${bookInfo.bookInfoName}》</h3>
        </div>
        <div class="panel-body">
            <form action="edit.html?bookInfoId=${bookInfo.bookInfoId}" method="post" id="addbook" >

                <div class="input-group">
                    <span  class="input-group-addon">书名</span>
                    <input type="text" class="form-control" name="bookInfoName" id="bookInfoName" value="${bookInfo.bookInfoName}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">作者</span>
                    <input type="text" class="form-control" name="bookInfoAuthor" id="bookInfoAuthor" value="${bookInfo.bookInfoAuthor}" >
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">出版社</span>
                    <input type="text" class="form-control" name="bookInfoPublish" id="bookInfoPublish"  value="${bookInfo.bookInfoPublish}" >
                </div>
                <div class="input-group">
                    <span class="input-group-addon">ISBN</span>
                    <input type="text" class="form-control" name="isbn" id="isbn"  value="${bookInfo.isbn}" >
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">简介</span>
                    <textarea class="form-control" rows="3" name="bookInfoIntroduction" id="bookInfoIntroduction"
                              placeholder="请输入图书简介">${bookInfo.bookInfoIntroduction}</textarea>
                </div>
                <div class="input-group">
                    <span class="input-group-addon">语言</span>
                    <input type="text" class="form-control" name="bookInfoLanguage" id="bookInfoLanguage" value="${bookInfo.bookInfoLanguage}" >
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">价格</span>
                    <input type="text" class="form-control" name="bookInfoPrice"  id="bookInfoPrice" value="${bookInfo.bookInfoPrice}">
                </div>
                <div class="input-group">
                    <span class="input-group-addon">出版日期</span>
                    <input type="text" class="form-control" name="bookInfoPubDate" id="bookInfoPubDate" value="<fmt:formatDate value="${bookInfo.bookInfoPubDate}" pattern="yyyy-MM-dd"/>">
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">分类号</span>
                    <select id="classId" name="classId" class="form-control">
                        <c:forEach items="${classInfoList}" var="classInfo">
                            <option value="${classInfo.classId}"
                                    <c:if test="${classInfo.classId == bookInfo.classId}">selected</c:if> >${classInfo.className}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">数量</span>
                    <input type="text" class="form-control" name="bookInfoNumber" id="bookInfoNumber" value="${bookInfo.bookInfoNumber}">
                </div>
                <input type="submit" value="确定" class="btn btn-success btn-sm" class="text-left">
                <script>
                    $("#addbook").submit(function () {
                        if($("#name").val()==''||$("#author").val()==''||$("#publish").val()==''||$("#isbn").val()==''||$("#introduction").val()==''||$("#language").val()==''||$("#price").val()==''||$("#pubstr").val()==''||$("#classId").val()==''||$("#number").val()==''){
                            alert("请填入完整图书信息！");
                            return false;
                        }
                    })
                </script>
            </form>
        </div>
    </div>

</div>

</body>
</html>
